﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Text;

namespace FirstHomeWork.Utility
{
    [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
    public class UserCreateFileAttribute : AbstractUserCreateFileAttribute
    {
        public override Action CreateFileAction(string filePath, Action action)
        {
            //做一点自己的事情，创建文件夹
            if (!string.IsNullOrEmpty(filePath))
            {
                if (!Directory.Exists(filePath))
                    Directory.CreateDirectory(filePath);
            }
            Action action1 = new Action(() =>
            {
                action.Invoke();
            });
            return action1;
        }
    }
}
